<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="t" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="fulbitofacil.negocio.*"%>
<%@ page import="fulbitofacil.modelo.*"%>
<t:if test="${sessionScope['tipo']!=2}">
   <% response.sendRedirect("Inicio.jsp");%>
</t:if>
<%@page import="fulbitofacil.modelo.Local"%>

<%@ page import="fulbitofacil.util.funciones"%>
<%@ page language="java" import="java.util.*,java.text.*"%>
<%@ page import="java.util.Calendar,java.util.GregorianCalendar"%>
<%-- <%@page import="java.util.*" session="true"%> --%>
<%
HttpSession sesion = request.getSession();
Persona p = (Persona)sesion.getAttribute("Persona");
%>
<%
	int idPersona = p.getId_persona();
	funciones f = new funciones();
	int iYear = f.nullIntconv(request.getParameter("iYear"));
	int iMonth = f.nullIntconv(request.getParameter("iMonth"));

	Calendar ca = new GregorianCalendar();
	int iTDay = ca.get(Calendar.DATE);
	int iTYear = ca.get(Calendar.YEAR);
	int iTMonth = ca.get(Calendar.MONTH);

	// 	out.println(iTDay+"-"+iTYear+'-'+iTMonth);
	if (iYear == 0) {
		iYear = iTYear;
		iMonth = iTMonth;
	}

	GregorianCalendar cal = new GregorianCalendar(iYear, iMonth, 1);

	int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
	int weekStartDay = cal.get(Calendar.DAY_OF_WEEK);

	cal = new GregorianCalendar(iYear, iMonth, days);
	int iTotalweeks = cal.get(Calendar.WEEK_OF_MONTH);
%>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Iniciar Sesion</title>
<link href="estilo.css" rel="stylesheet"/>
<script src="js/script0.js"></script>
<link href="Css/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script src="js/script0.js"></script>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script>
		$(function() {
			$.datepicker.regional['es'] = {
				closeText : 'Cerrar',
				prevText : '&#x3c;Ant',
				nextText : 'Sig&#x3e;',
				currentText : 'Hoy',
				monthNames : [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo',
						'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre',
						'Noviembre', 'Diciembre' ],
				monthNamesShort : [ 'Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun',
						'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic' ],
				dayNames : [ 'Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles',
						'Jueves', 'Viernes', 'S&aacute;bado' ],
				dayNamesShort : [ 'Dom', 'Lun', 'Mar', 'Mi&eacute;', 'Juv',
						'Vie', 'S&aacute;b' ],
				dayNamesMin : [ 'Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'S&aacute;' ],
				weekHeader : 'Sm',
				dateFormat : 'yy-mm-dd',
				firstDay : 1,
				isRTL : false,
				showMonthAfterYear : false,
				yearSuffix : ''
			};
			$.datepicker.setDefaults($.datepicker.regional['es']);
			var dates = $("#from, #to")
					.datepicker(
							{
								defaultDate : "+1w",
								changeMonth : true,
								numberOfMonths : 1,
								onSelect : function(selectedDate) {
									var option = this.id == "from" ? "minDate"
											: "maxDate", instance = $(this)
											.data("datepicker"), date = $.datepicker
											.parseDate(
													instance.settings.dateFormat
															|| $.datepicker._defaults.dateFormat,
													selectedDate,
													instance.settings);
									dates.not(this).datepicker("option",
											option, date);
								}
							});

		});
	</script>
</head>
<body>

	<%@include file="header.jsp"%>

	<div class="art-post-inner art-article">
		<h1 class="art-postheader">FULBITO FACIL</h1>
		<div class="art-postcontent">

			<form action="MostrarAlquileresServlet" method="post" name="frm" onsubmit="return ValidarMostrarAlquiler();">
						<h3 class="date">Ingresar la informacion</h3>
						<table cellpadding="5">
							<tr>
								<td>Local</td>
								<td><select name="cboLocal">
										<%
											LocalNegocio cboLocal = new LocalNegocio();
											ArrayList local = (ArrayList) cboLocal.ListarLocal(idPersona);
											// 											out.println(local.size());
										%>
										<%
											for (int i = 0; i < local.size(); i++) {
												Local l = (Local) local.get(i);
										%>
										<option value="<%=l.getIdLocal()%>">
											<%=l.getDescripcion()%></option>
										<%
											}
										%>
								</select></td>
							</tr>
							<tr>
								<td>Fecha Inicio:</td>
								<td>
									<!-- 									<script type="text/javascript"> --> <!-- // 										idfecha1Calendar = createCalendario( "idfecha1", "idfecha1CalendarContiner", "img/", "yyyy-MM-dd", "spanish" ); -->
									<!-- 	              					</script>    --> 
<!-- 									<input type="text" name="txtFecha1" id="txtFecha1" placeholder="2012-04-01"> -->
									<input id="from" class="medio2" name="txtFecha1" type="text" required>
								</td>
							</tr>
							<tr>
								<td>Fecha Fin:</td>
								<td>
<!-- 									<input type="text" name="txtFecha2" id="txtFecha2" placeholder="2012-04-30"> -->
									<input id="to" class="medio2" name="txtFecha2" type="text" required>
								</td>
							</tr>
							<tr>
								<td align="center" colspan="2"><input type="submit"
									value="Buscar"></td>
							</tr>
						</table>
						<h3 class="date">Resultado</h3>

						<div class="date"></div>
					</form>


					<table border="1" class="tabla">
						<tr align="center">
							<td class="title1" width="100">Cancha</td>
							<td class="title1"  width="100">Fecha Alquiler</td>
							<td class="title1"  width="300">Cliente</td>
						</tr>
						<c:forEach items="${requestScope.Alquiler}" var="r" varStatus="i">
							<tr align="center">
								<td class="centro">${r.getMyCanchaFul().getNombre()}</td>
								<td class="centro">${r.getFechaAlquiler()}</td>								
								<td class="centro">${r.getMyCliente().getNombres()} ${r.getMyCliente().getPaterno()} ${r.getMyCliente().getMaterno()}</td>
							</tr>
						</c:forEach>

					</table>

			
		</div>
		<div class="cleared"></div>
	</div>

	<%@include file="footer.jsp"%>




</body>
</html>
